<template>
	<view class="plr15">
		<view class="flex spaceb alcenter list-content mt15" v-for="(item,index) in list" @click="detail(item.id)">
			<view class="fl1 pd15">
				<view class="ftw600 ft18">{{item.title}}</view>
				<view class="flex alcenter plt5">
					<image src="@/static/images/ditu2.png" mode="" style="width: 30rpx;height: 30rpx;"></image>
					<view class="cl-info ml4">{{item.address}}</view>
				</view>
				<view class="flex spaceb mt5">
					<view><span class="cl-info">编号：</span>{{item.number}}</view>
					<view><span class="cl-info">数量：</span>{{item.use}}(有货)/{{item.num}}(总数)个</view>
				</view>
			</view>
			<view class="ft18 btn" v-if="item.status==0" style="background: #FF8400;">停用</view>
			<view class="ft18 btn" v-if="item.status==1" style="background: #01C255;">正常</view>
		</view>
		<u-empty mode="list" text="暂无柜机" v-if="list==''" margin-top="200"></u-empty>
		<button @click="to_tiaozhuan('gzAdd')">添加柜机</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
			}
		},
		onLoad(o) {
		},
		onShow() {
			this.getGzlist()
			//#ifdef MP-WEIXIN
			wx.showShareMenu({
				withShareTicket: true,
				menus: ['shareAppMessage', 'shareTimeline']
			})

			//#endif
		},
		methods: {
			to_tiaozhuan(url) {
				uni.navigateTo({
					url: url
				})
			},
			detail(id){
				uni.navigateTo({
					url: '/pagesA/shangjia/guizi/detail?cabinetid='+id
				})
			},
			makecall(index) {
				uni.makePhoneCall({
					phoneNumber: this.allstore[index].phone
				})
			},
			getGzlist() {
				this.global.request.post({
					data: {
						do: 'Shop_cabinet',
						s_id:uni.getStorageSync("s_id")
					},
					success: res => {
						this.list = res
					}
				})
			},
		}
	}
</script>
<style>
	page {
		background: #F7F7F7;
	}
</style>
<style lang="scss" scoped>
	.list-content {
		border-radius: 20rpx;
		background: #FFFFFF;
	}

	button {
		width: 92%;
		background-color: #44cc00;
		color: white;
		position: fixed;
		bottom: 0;
		margin-bottom: 20rpx;
	}

	.border-bottom {
		border-bottom: 1px solid #e5e5e5;
	}

	.btn {
		width: 140rpx;
		border-radius: 0 20rpx 20rpx 0;
		color: #FFFFFF;
		height: 200rpx;
		line-height: 200rpx;
		text-align: center;
		font-weight: bold;
	}
</style>
